unit U_fm_import_xml;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;

type
  Tfm_import_xml = class(TForm)
    btn2: TBitBtn;
    btn3: TBitBtn;
    grp1: TGroupBox;
    edt1: TEdit;
    lbl1: TLabel;
    btn4: TBitBtn;
    dlgOpen1: TOpenDialog;
    procedure btn4Click(Sender: TObject);
    procedure btn2Click(Sender: TObject);
    procedure btn3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fm_import_xml: Tfm_import_xml;

implementation

{$R *.dfm}

uses U_dm_principal, U_cad_incidente;

procedure Tfm_import_xml.btn2Click(Sender: TObject);
begin
      if edt1.Text = ''  then
          Begin
            ShowMessage('Informe o Path do arquivo');
              //Abort;
               dm_principal.cds_cad_incidente.Edit;
          end
       else
      // dm_principal.cds_cad_incidente.Edit;
    //dm_principal.cds_cad_incidente.Insert;
    dm_principal.cds_cad_incidente.LoadFromFile(edt1.Text);

  //dm_principal.cds_cad_incidente.Post;
  //dm_principal.cds_cad_incidente.ApplyUpdates(0);
 //fm_cad_incidente.btngravarClick(self);


end;

procedure Tfm_import_xml.btn3Click(Sender: TObject);
begin
  dm_principal.cds_cad_incidente.Cancel;
  dm_principal.cds_cad_incidente.Edit;

end;

procedure Tfm_import_xml.btn4Click(Sender: TObject);
begin
 dlgOpen1.Filter:='Arquivos De Texto (*.XML)';

     If (dlgOpen1.Execute) Then
      edt1.Text:=dlgOpen1.FileName;
end;

end.
